package com.egg.ylt.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.egg.ylt.R;
import com.egg.ylt.Utils.GlideRoundTransform;
import com.egg.ylt.activity.ACT_WaterBathDivision;
import com.egg.ylt.pojo.NatatoriumByidEntity;
import com.yonyou.framework.library.adapter.rv.CommonAdapter;
import com.yonyou.framework.library.adapter.rv.ViewHolder;

/**
 * Created by lijiateng on 2019/2/26.
 */

public class ADA_ShopDetailTeacher extends CommonAdapter<NatatoriumByidEntity.TeacherListBean> {

    public ADA_ShopDetailTeacher(Context context) {
        super(context);
    }

    @Override
    protected int itemLayoutId() {
        return R.layout.item_shop_detail_server;
    }

    @Override
    protected void convert(ViewHolder holder, final NatatoriumByidEntity.TeacherListBean teacherListBean, int position) {
        Glide.with(mContext)
                .load(teacherListBean.getIamgeUrl())
                .transform(new GlideRoundTransform(mContext))
                .transition(new DrawableTransitionOptions().crossFade())
                .placeholder(R.mipmap.ic_teacher_default)
                .into((ImageView) holder.getView(R.id.iv_server_image));
        holder.setText(R.id.tv_server_name, teacherListBean.getName());
        holder.setText(R.id.tv_server_exp, teacherListBean.getExperience() + "经验");

        holder.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, ACT_WaterBathDivision.class);
                intent.putExtra("id", teacherListBean.getId());
                mContext.startActivity(intent);
            }
        });
    }

}
